package com.kye.express.business.president_online;

import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;

import com.kye.express.R;
import com.kye.express.business.base.BaseToolbarActivity;
import com.kye.express.business.invoice_online.detail.ElectronicInvoiceFragment;
import com.kye.express.business.invoice_online.detail.InvoiceDetailFragment;
import com.kye.express.business.invoice_online.detail.InvoiceDetailListener;
import com.kye.express.business.invoice_online.detail.WaybillListFragment;
import com.kye.express.databinding.ActivityBaseFragmentContainsBinding;
import com.kye.express.databinding.ActivityPresidentOnlineBinding;
import com.kye.model.bean.president_online.PresidentOnlineListBean;

/**
 * 总裁热线
 */
public class PresidentOnlineActivity extends BaseToolbarActivity implements PresidentOnlineListener {

    private ActivityPresidentOnlineBinding mBinding;

    public static void startActivity(Context context) {
        Intent intent = new Intent(context, PresidentOnlineActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_president_online);
        setUpToolbar((Toolbar) findViewById(R.id.toolbar));

        FragmentTransaction transaction = getSupportFragmentManager()
                .beginTransaction();
        transaction.replace(R.id.contains, PresidentOnlineListFragment.newInstance()).commit();
        transaction.addToBackStack(null);
    }

    @Override
    public void onAddMessage() {
        FragmentTransaction transaction = getSupportFragmentManager()
                .beginTransaction();
        transaction.replace(R.id.contains, PresidentOnlineAddFragment.newInstance(null)).commit();
        transaction.addToBackStack(null);
    }

    @Override
    public void onGoToDetail(PresidentOnlineListBean.DatasBean datasBean) {
        FragmentTransaction transaction = getSupportFragmentManager()
                .beginTransaction();
        transaction.replace(R.id.contains, PresidentOnlineDetailFragment.newInstance(datasBean)).commit();
        transaction.addToBackStack(null);
    }

    @Override
    public void onEdit(PresidentOnlineListBean.DatasBean datasBean) {
        FragmentTransaction transaction = getSupportFragmentManager()
                .beginTransaction();
        transaction.replace(R.id.contains, PresidentOnlineAddFragment.newInstance(datasBean)).commit();
        transaction.addToBackStack(null);
    }
}
